home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Ian & Stuart's Australian Mac: Not for Sale
/
Another.not.for.sale (Australia).iso
/
fade into you
/
getting there
/
Apps
/
MOO-1.7.6.src
/
inc
/
execute.h
< prev
next >
Wrap
Text File
|
1994-11-02
|
5KB
|
137 lines
/******************************************************************************
Copyright (c) 1992 Xerox Corporation. All rights reserved.
Portions of this code were written by Stephen White, aka ghond.
Use and copying of this software and preparation of derivative works based
upon this software are permitted. Any distribution of this software or
derivative works must comply with all applicable United States export
control laws. This software is made available AS IS, and Xerox Corporation
makes no warranty about the software, its performance or its conformity to
any specification. Any person obtaining a copy of this software is requested
to send their name and post office or electronic mail address to:
Pavel Curtis
Xerox PARC
3333 Coyote Hill Rd.
Palo Alto, CA 94304
Pavel@Xerox.Com
*****************************************************************************/
#ifndef Execute_h
#define Execute_h 1
#include "bytecodes.h"
#include "config.h"
#include "opcode.h"
#include "options.h"
#include "program.h"
#include "structures.h"
typedef struct {
Program *prog;
Var *rt_env; /* same length as prog.var_names */
Var *base_rt_stack;
Var *top_rt_stack; /* the stack has a fixed size equal to prog.num_var_names;
top_rt_stack always points to next empty slot;
there is no need to check bounds! */
unsigned pc;
unsigned error_pc;
Byte bi_func_pc; /* next == 0 means a normal activation, which just
returns to the previous activation (caller verb).
next == 1, 2, 3, ... means the returned value should be
fed to the bi_func (as specified in bi_func_id)
together with the next code. */
Byte bi_func_id;
void *bi_func_data;
Var temp; /* VM's temp register */
/* verb information */
Objid this;
Objid player;
Objid progr;
Objid vloc;
const char *verb;
const char *verbname;
int debug;
} activation;
typedef activation activation_stack[MAX_VERB_DEPTH];
extern void free_activation(activation a, char data_too);
typedef struct {
activation_stack activ_stack;
unsigned top_activ_stack;
int root_activ_vector;
/* root_activ_vector == MAIN_VECTOR
means root activation is main_vector */
unsigned func_id;
} vmstruct;
typedef vmstruct *vm;
#define alloc_data(size) mymalloc(size, M_BI_FUNC_DATA)
#define free_data(ptr) myfree((void *) ptr, M_BI_FUNC_DATA)
/* call_verb will only return E_MAXREC, E_INVIND, E_VERBNF, E_TYPE (for args)
or E_NONE. the vm will only be changed if E_NONE is returned */
extern enum error call_verb(Objid obj, const char *vname, Var args,
int do_pass);
extern int setup_activ_for_eval(Program *prog);
extern Var do_forked_task(Program *prog, Var *rt_env, activation a,
unsigned f_id);
extern Var do_input_task(Program *prog, Parse_Info *pi);
extern Var do_server_task(Objid this, const char *verb, Var args,
Objid vloc, const char *verbname, Program *prog,
Objid progr, int debug, Objid player,
const char *argstr);
extern int task_timed_out;
extern void abort_running_task(void);
extern void print_error_backtrace(const char *, int);
extern Var resume_from_previous_vm(vm the_vm, Var v);
extern void free_rt_env(Var *, unsigned);
extern Var *new_rt_env(unsigned);
extern void write_activ(activation a);
extern int read_activ(FILE *f, activation *a, int which_vector);
#endif
/* $Log: execute.h,v $
* Revision 1.10 1992/10/23 23:03:47 pavel
* Added copyright notice.
*
* Revision 1.9 1992/10/21 03:02:35 pavel
* Converted to use new automatic configuration system.
*
* Revision 1.8 1992/10/17 20:29:09 pavel
* Changed return-type of read_activ() from char to int, for systems that use
* unsigned chars.
*
* Revision 1.7 1992/09/25 21:11:03 pjames
* Added error_pc to the activation data structure.
*
* Revision 1.6 1992/09/24 16:43:35 pavel
* Added `task_timed_out' to the interface.
*
* Revision 1.5 1992/09/02 18:42:25 pavel
* Fixed resume_from_previous_vm() to accept any MOO value as the resumption
* value, instead of just strings.
*
* Revision 1.4 1992/08/31 22:27:38 pjames
* Changed some `char *'s to `const char *'
*
* Revision 1.3 1992/08/10 17:44:28 pjames
* Moved several functions declarations to eval_env.h and eval_vm.h
*
* Revision 1.2 1992/07/27 18:01:45 pjames
* Changed name of ct_env to var_names
*
* Revision 1.1 1992/07/20 23:23:12 pavel
* Initial RCS-controlled version.
* */